import { Model } from 'pinia-orm';
import { Attr, Str, Uid, Num, Bool, HasOne, HasMany, BelongsTo, HasManyBy, BelongsToMany, MorphOne,
  MorphTo, MorphMany, MorphToMany, OnDelete
  } from 'pinia-orm/decorators';
import { useAxiosRepo } from '@pinia-orm/axios';
import { useAppConfig } from '@vben/hooks';
import type { WechatopenMiniappUsers, WechatopenMiniappUsersResponse } from '../../views/uctoo/wechatopen_miniapp_users/types.js';
//#region Human-Code Preservation

//#endregion Human-Code Preservation

const { apiURL } = useAppConfig(import.meta.env, import.meta.env.PROD);

export class uctoo_wechatopen_miniapp_users extends Model {
  static override entity = 'uctoo_wechatopen_miniapp_users'

@Uid() declare id: string 
@Uid() declare user_id: string | null
@Uid() declare ai_user_id: string | null
@Str('') declare appid: string 
@Str('') declare openid: string 
@Str('') declare unionid: string | null
@Str('') declare nickname: string | null
@Str('') declare phone_number: string | null
@Str('') declare pure_phone_number: string | null
@Str('') declare country_code: string | null
@Str('') declare password: string | null
@Num(0) declare gender: number | null
@Str('') declare city: string | null
@Str('') declare province: string | null
@Str('') declare country: string | null
@Str('') declare avatar_url: string | null
@Str('') declare language: string | null
@Num(0) declare subscribe: number 
@Attr('') declare subscribe_time: string 
@Str('') declare remark: string | null
@Str('') declare tagid_list: string | null
@Str('') declare subscribe_scene: string | null
@Str('') declare qr_scene: string | null
@Str('') declare qr_scene_str: string | null
@Str('') declare privilege: string | null
@Str('') declare loginip: string | null
@Str('') declare token: string | null
@Str('') declare access_token: string | null
@Attr('') declare access_token_overtime: string 
@Str('') declare session_key: string | null
@Str('') declare verification: string | null
@Str('') declare ai_user_info: string | null
@Num(0) declare status: number 
@Uid() declare creator: string | null
@Attr('') declare created_at: string 
@Attr('') declare updated_at: string 
@Attr('') declare deleted_at: string | null
@Str('') declare refresh_token: string | null


  static override config = {
    axiosApi: {
        actions: {
            getuctooWechatopenMiniappUsersList(page: number, pageSize: number, searchParams?: any){
                return useAxiosRepo(uctoo_wechatopen_miniapp_users).api().get(`/uctoo/wechatopen_miniapp_users/${pageSize}/${page}`, {
                  params: searchParams,
                  headers: { 'Content-Type': 'application/json;charset=utf-8',
                          'Authorization': `Bearer ${localStorage.getItem('accessToken')}` 
                  },
                  baseURL: apiURL,
                  dataKey: 'wechatopenMiniappUserss'
                })
            },
            getuctooWechatopenMiniappUsers(id: string){
              return useAxiosRepo(uctoo_wechatopen_miniapp_users).api().get(`/uctoo/wechatopen_miniapp_users/${id}`, {
                headers: { 'Content-Type': 'application/json;charset=utf-8',
                        'Authorization': `Bearer ${localStorage.getItem('accessToken')}` 
                },
                baseURL: apiURL,
              })
            },
            adductooWechatopenMiniappUsers(data: Partial<WechatopenMiniappUsers>){
              return useAxiosRepo(uctoo_wechatopen_miniapp_users).api().post('/uctoo/wechatopen_miniapp_users/add', data, {
                headers: { 'Content-Type': 'application/json;charset=utf-8',
                        'Authorization': `Bearer ${localStorage.getItem('accessToken')}` 
                },
                baseURL: apiURL,
              })
            },
            edituctooWechatopenMiniappUsers(data: any){
              return useAxiosRepo(uctoo_wechatopen_miniapp_users).api().post('/uctoo/wechatopen_miniapp_users/edit', data, {
                headers: { 'Content-Type': 'application/json;charset=utf-8',
                        'Authorization': `Bearer ${localStorage.getItem('accessToken')}` 
                },
                baseURL: apiURL,
              })
            },
            deleteuctooWechatopenMiniappUsers(data: any){
              return useAxiosRepo(uctoo_wechatopen_miniapp_users).api().post('/uctoo/wechatopen_miniapp_users/del', data, {
                headers: { 'Content-Type': 'application/json;charset=utf-8',
                        'Authorization': `Bearer ${localStorage.getItem('accessToken')}` 
                },
                baseURL: apiURL,
              })
            },

//#region Human-Code Preservation

//#endregion Human-Code Preservation
        } 
    }
  }
}
